package com.aifast.crm.customer.entity;


import com.aifast.common.base.BaseEntity;
import com.aifast.common.desensitize.Desensitize;
import com.aifast.common.desensitize.DesensitizeType;
import com.aifast.common.dict.DictBind;
import com.aifast.common.dict.DictBindEasyExcelConverter;
import com.aifast.common.dict.DictBindType;
import com.aifast.common.global.Const;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;

/**
 * 客户信息对象 crm_customer
 *
 * @author fujian
 * @date 2022-08-24
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class CrmCustomer extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 雪花ID
     */
    @ExcelIgnore
    @TableField(fill = FieldFill.INSERT)
    private Long snowflake;
    /**
     * 姓名
     */
    @ExcelProperty("姓名")
    @NotBlank
    private String name;

    /**
     * 性别
     */
    @ExcelProperty(value = "性别",converter = DictBindEasyExcelConverter.class)
    @DictBind(type = "sex")
    private Integer sex;

    /**
     * 省市
     */
    @ExcelProperty(value = "省市",converter = DictBindEasyExcelConverter.class)
    @DictBind(mode = DictBindType.JOIN,tableName = "fd_area",columns = "name",joinSymbol = Const.SYMBOL_COMMA,target = "areaName")
    private String area;

    /**
     * 类型
     */
    @ExcelProperty(value = "类型",converter = DictBindEasyExcelConverter.class)
    @DictBind(type = "customerType")
    private Integer type;

    /**
     * 来源
     */
    @ExcelProperty(value = "来源",converter = DictBindEasyExcelConverter.class)
    @DictBind(type = "customerSource")
    private Integer source;

    /**
     * 标签
     */
    @ExcelProperty(value = "标签",converter = DictBindEasyExcelConverter.class)
    @DictBind(type = "customerLabel")
    private Integer label;

    /**
     * 联系方式
     */
    @ExcelProperty("联系方式")
    @Desensitize(DesensitizeType.MOBILE_PHONE)
    private String mobile;

    /**
     * 其他联系
     */
    @ExcelProperty("其他联系")
    private String spareMobile;

    /**
     * 描述内容
     */
    @ExcelProperty("描述内容")
    private String description;

    /**
     * 部门
     */
    @ExcelProperty("部门")
    private Integer orgId;

    /**
     * 是否加微信
     */
    @ExcelProperty(value = "是否加微信",converter = DictBindEasyExcelConverter.class)
    @DictBind(type = "boolean")
    private String isJoinWx;

    /**
     * 归属用户 私客
     */
    @ExcelIgnore
    private String belongUser;

    /**
     * 归属公客池
     */
    @ExcelIgnore
    private String belongSeas;

    /**
     * 行业
     */
    @ExcelProperty("行业")
    private Integer trade;

}
